<template>
  <el-config-provider :locale="zhCn">
    <RouterView></RouterView>
  </el-config-provider>
</template>
<script setup>
import { RouterView } from 'vue-router';
import { ElConfigProvider } from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn';

// //初始化自适应  ----在刚显示的时候就开始适配一次
// handleScreenAuto();
// //绑定自适应函数   ---防止浏览器栏变化后不再适配
// window.onresize = () => {
//   handleScreenAuto();
// }

function handleScreenAuto() {
  const designDraftWidth = 3840;//设计稿的宽度
  const designDraftHeight = 2160;//设计稿的高度
  const design = designDraftWidth / designDraftHeight;
  let clientWidth = document.documentElement.clientWidth;
  let clientHeight = document.documentElement.clientHeight;
  let client = clientWidth / clientHeight;
  //根据屏幕的变化适配的比例
  const scale = client < design ? (clientWidth / designDraftWidth) : (clientHeight / designDraftHeight);
  //缩放比例
  document.querySelector('#app').style.transform = `scale(${scale}) translate(-50%)`;
}
</script>



<style scoped></style>
